home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 February / Gamestar_81_2006-02_dvd.iso / Red Shark / Missions / Mission_14 / MissionTasks.script < prev    next >
Text File  |  2001-11-09  |  17KB  |  363 lines

  1. //-------------------------------------------------------------------
  2. //
  3. //  This code is copyright 2001 by G5 Software.
  4. //  Any unauthorized usage, either in part or in whole of this code
  5. //  is strictly prohibited. Violators WILL be prosecuted to the
  6. //  maximum extent allowed by law.
  7. //
  8. //-------------------------------------------------------------------
  9.  
  10. ///////////////////////////////////
  11. //
  12. // Mission 14 -- Eliminate Descent
  13. //
  14. ///////////////////////////////////
  15. class CMission14_AIController extends CBaseAIController, CEliminateDescentMission_Strings
  16. {
  17.   array  ActivatePointCenterList = array(
  18.     vector( 6622, 4148, 0 )     //
  19.     );    //
  20.   array  ActivatePointRadiusList = array(
  21.     100.0                       //
  22.     );
  23.   array  ActivatePointNameList = array(
  24.     "A"
  25.     );
  26.  
  27.   int MissionStartTime     = 0;          // Time initialized
  28.  
  29.   int ZillahTroops   = 10000;      // Start group 1 paratroopers
  30.   int BwairatTroops  = 180000;      // Start group 2 paratroopers
  31.   int BenghaziTroops = 80000;      // Start group 3 paratroopers
  32. //  int ZillahTroops   = 100000000;      // Start group 1 paratroopers
  33. //  int BwairatTroops  = 180000000;      // Start group 2 paratroopers
  34. //  int BenghaziTroops = 900000000;      // Start group 3 paratroopers
  35.  
  36.   boolean ZillahTroopsUp   = false;
  37.   boolean BwairatTroopsUp  = false;
  38.   boolean BenghaziTroopsUp = false;
  39.  
  40.   void Init( int _Time )
  41.   {
  42.     MissionStartTime = _Time;
  43.   }
  44.   void Update( int _Time )
  45.   {
  46.     if ( (_Time>= (MissionStartTime + ZillahTroops)) && ( !ZillahTroopsUp ) )
  47.      {
  48.        ZillahTroopsUp = true;
  49.        Core_SendEventTo( "Helicopter",
  50.           "OnDisplayMessage",
  51.           str_ZilahDropped,
  52.           color(0.5, 05, 0.0));
  53.        Core_ScheduleTask(SOID_MissionController,
  54.                          OT_SendEventTo,
  55.                          0.1,
  56.                          "GenerateParatroopers",
  57.                          "14_PZillahFlak",                // Name of group w/o number
  58.                          2,                              // Groups amount
  59.                          4,                              // Paratroopers in group
  60.                          vector(5400.0, 10730.0, 450.0), // point of landing
  61.                          150.0,                          // Radius
  62.                          30.0,                           // Hight
  63.                          "14_ZillahFlak",                // Name of unit after landing
  64.                          "CGermanMobileFlak",            // Class of unit after landing
  65.                          2,                              // Min troopers amount for unit creating
  66.                          2.0                             // Distribution time for paratroopers creation
  67.                        );
  68.        Core_ScheduleTask(SOID_MissionController,
  69.                          OT_SendEventTo,
  70.                          0.3,
  71.                          "GenerateParatroopers",
  72.                          "14_PZillahAA",                  // Name of group w/o number
  73.                          5,                              // Groups amount
  74.                          4,                              // Paratroopers in group
  75.                          vector(5400.0, 10730.0, 400.0), // point of landing
  76.                          150.0,                          // Radius
  77.                          30.0,                           // Hight
  78.                          "14_ZillahAA",                  // Name of unit after landing
  79.                          "CGermanAntiair",               // Class of unit after landing
  80.                          2,                              // Min troopers amount for unit creating
  81.                          2.0                             // Distribution time for paratroopers creation
  82.                        );
  83.        Core_ScheduleTask(SOID_MissionController,
  84.                          OT_SendEventTo,
  85.                          0.5,
  86.                          "GenerateParatroopers",
  87.                          "14_PZillahJeep",                // Name of group w/o number
  88.                          4,                              // Groups amount
  89.                          4,                              // Paratroopers in group
  90.                          vector(5400.0, 10730.0, 400.0), // point of landing
  91.                          150.0,                          // Radius
  92.                          30.0,                           // Hight
  93.                          "14_ZillahJeep",                // Name of unit after landing
  94.                          "CGermanAJeep",                 // Class of unit after landing
  95.                          2,                              // Min troopers amount for unit creating
  96.                          2.0                             // Distribution time for paratroopers creation
  97.                        );
  98. //       Core_SendEventTo(
  99. //                 "Helicopter",
  100. //                 "ShowEventPoint",
  101. //                 vector(5400.0, 10730.0, 400.0), //     - id of object to show
  102. //                 100.0,                          //     - distance from camera to object
  103. //                 false
  104. //               );
  105.          Core_ScheduleTask(
  106.                  "Helicopter",
  107.                  OT_SendEventTo,
  108.                  2.5,
  109.                  "ShowEventPoint",
  110.                  vector(5400.0, 10730.0, 400.0),
  111.                  100.0,
  112.                  false
  113.                );
  114.      }
  115. //    if ( (_Time>= (MissionStartTime + BwairatTroops)) && ( !BwairatTroopsUp ) )
  116. //     {
  117. //       BwairatTroopsUp = true;
  118. //       Core_SendEventTo( "Helicopter",
  119. //          "OnDisplayMessage",
  120. //          str_BwairatDropped,
  121. //          color(1.0, 0.0, 0.0));
  122. //
  123. //     }
  124.     if ( (_Time>= (MissionStartTime + BenghaziTroops)) && ( !BenghaziTroopsUp ) )
  125.      {
  126.        BenghaziTroopsUp = true;
  127.        Core_SendEventTo( "Helicopter",
  128.           "OnDisplayMessage",
  129.           str_BenghaziDropped,
  130.           color(0.5, 0.5, 0.0));
  131.        Core_ScheduleTask(SOID_MissionController,
  132.                          OT_SendEventTo,
  133.                          0.1,
  134.                          "GenerateParatroopers",
  135.                          "14_PBenghaziFlak",              // Name of group w/o number
  136.                          2,                              // Groups amount
  137.                          4,                              // Paratroopers in group
  138.                          vector(5400.0, 10730.0, 450.0), // point of landing
  139.                          150.0,                          // Radius
  140.                          30.0,                           // Hight
  141.                          "14_BenghaziFlak",              // Name of unit after landing
  142.                          "CGermanMobileFlak",            // Class of unit after landing
  143.                          2,                              // Min troopers amount for unit creating
  144.                          2.0                             // Distribution time for paratroopers creation
  145.                        );
  146.        Core_ScheduleTask(SOID_MissionController,
  147.                          OT_SendEventTo,
  148.                          0.3,
  149.                          "GenerateParatroopers",
  150.                          "14_PBenghaziAA",                // Name of group w/o number
  151.                          5,                              // Groups amount
  152.                          4,                              // Paratroopers in group
  153.                          vector(5400.0, 10730.0, 400.0), // point of landing
  154.                          150.0,                          // Radius
  155.                          30.0,                           // Hight
  156.                          "14_BenghaziAA",                // Name of unit after landing
  157.                          "CGermanAntiair",               // Class of unit after landing
  158.                          2,                              // Min troopers amount for unit creating
  159.                          2.0                             // Distribution time for paratroopers creation
  160.                        );
  161.        Core_ScheduleTask(SOID_MissionController,
  162.                          OT_SendEventTo,
  163.                          0.5,
  164.                          "GenerateParatroopers",
  165.                          "14_PBenghaziJeep",              // Name of group w/o number
  166.                          4,                              // Groups amount
  167.                          4,                              // Paratroopers in group
  168.                          vector(5400.0, 10730.0, 400.0), // point of landing
  169.                          150.0,                          // Radius
  170.                          30.0,                           // Hight
  171.                          "14_BenghaziJeep",              // Name of unit after landing
  172.                          "CGermanAJeep",                 // Class of unit after landing
  173.                          2,                              // Min troopers amount for unit creating
  174.                          2.0                             // Distribution time for paratroopers creation
  175.                        );
  176.          Core_ScheduleTask(
  177.                  "Helicopter",
  178.                  OT_SendEventTo,
  179.                  2.5,
  180.                  "ShowEventPoint",
  181.                  vector(5400.0, 10730.0, 400.0),
  182.                  100.0,
  183.                  false
  184.                );
  185.      }
  186.     if ( (_Time>= (MissionStartTime + BwairatTroops)) && ( !BwairatTroopsUp ) )
  187.      {
  188.        BwairatTroopsUp = true;
  189.        Core_SendEventTo( "Helicopter",
  190.           "OnDisplayMessage",
  191.           str_BwairatDropped,
  192.           color(0.5, 0.5, 0.0));
  193.        Core_ScheduleTask(SOID_MissionController,
  194.                          OT_SendEventTo,
  195.                          0.1,
  196.                          "GenerateParatroopers",
  197.                          "14_PBwairatFlak",               // Name of group w/o number
  198.                          2,                              // Groups amount
  199.                          2,                              // Paratroopers in group
  200.                          vector(5400.0, 10730.0, 450.0), // point of landing
  201.                          150.0,                          // Radius
  202.                          30.0,                           // Hight
  203.                          "14_BwairatFlak",               // Name of unit after landing
  204.                          "CGermanMobileFlak",            // Class of unit after landing
  205.                          2,                              // Min troopers amount for unit creating
  206.                          2.0                             // Distribution time for paratroopers creation
  207.                        );
  208.        Core_ScheduleTask(SOID_MissionController,
  209.                          OT_SendEventTo,
  210.                          0.3,
  211.                          "GenerateParatroopers",
  212.                          "14_PBwairatAA",                 // Name of group w/o number
  213.                          4,                              // Groups amount
  214.                          4,                              // Paratroopers in group
  215.                          vector(5400.0, 10730.0, 400.0), // point of landing
  216.                          150.0,                          // Radius
  217.                          30.0,                           // Hight
  218.                          "14_BwairatAA",                 // Name of unit after landing
  219.                          "CGermanAntiair",               // Class of unit after landing
  220.                          2,                              // Min troopers amount for unit creating
  221.                          2.0                             // Distribution time for paratroopers creation
  222.                        );
  223.        Core_ScheduleTask(SOID_MissionController,
  224.                          OT_SendEventTo,
  225.                          0.5,
  226.                          "GenerateParatroopers",
  227.                          "14_PBwairatJeep",               // Name of group w/o number
  228.                          2,                              // Groups amount
  229.                          4,                              // Paratroopers in group
  230.                          vector(5400.0, 10730.0, 400.0), // point of landing
  231.                          150.0,                          // Radius
  232.                          30.0,                           // Hight
  233.                          "14_BwairatJeep",               // Name of unit after landing
  234.                          "CGermanAJeep",                 // Class of unit after landing
  235.                          2,                              // Min troopers amount for unit creating
  236.                          2.0                             // Distribution time for paratroopers creation
  237.                        );
  238.          Core_ScheduleTask(
  239.                  "Helicopter",
  240.                  OT_SendEventTo,
  241.                  2.5,
  242.                  "ShowEventPoint",
  243.                  vector(5400.0, 10730.0, 400.0),
  244.                  100.0,
  245.                  false
  246.                );
  247.      }
  248.   }
  249.  
  250.   boolean m_ZillahCaptured   = false;
  251.   boolean m_BenghaziCaptured = false;
  252.   boolean m_BwairatCaptured  = false;
  253.  
  254.   void OnObjectEnterArea( int _AreaIndex, string _NavPointName, string _ObjectID)
  255.   {
  256.     if (    Core_IsStringStartsWith( _NavPointName, "NavPoint_04")
  257.          && Core_IsStringStartsWith( _ObjectID, "14_Zillah") && !m_ZillahCaptured )
  258.     {
  259.       Core_SendEventTo( "Helicopter",
  260.           "OnDisplayMessage",
  261.           str_ZillahCaptured,
  262.           color(1.0, 0.0, 0.0));
  263.       Core_BroadcastEvent("ZillahDescentArrival");
  264.       m_ZillahCaptured = true;
  265.     }
  266.     if (    Core_IsStringStartsWith( _NavPointName, "NavPoint_02")
  267.          && Core_IsStringStartsWith( _ObjectID, "14_Benghazi") && !m_BenghaziCaptured )
  268.     {
  269.       Core_SendEventTo( "Helicopter",
  270.           "OnDisplayMessage",
  271.           str_BenghaziCaptured,
  272.           color(1.0, 0.0, 0.0));
  273.       Core_BroadcastEvent("BenghaziDescentArrival");
  274.       m_BenghaziCaptured = true;
  275.     }
  276.     if (    Core_IsStringStartsWith( _NavPointName, "NavPoint_03")
  277.          && Core_IsStringStartsWith( _ObjectID, "14_Bwairat") && !m_BwairatCaptured )
  278.     {
  279.       Core_SendEventTo( "Helicopter",
  280.           "OnDisplayMessage",
  281.           str_BwairatCaptured,
  282.           color(1.0, 0.0, 0.0));
  283.       Core_BroadcastEvent("BwairatDescentArrival");
  284.       m_BwairatCaptured = true;
  285.     }
  286.   }
  287. }
  288. class C14_ZillahDescent extends CBaseAITask_BaseTask, CNavPointUser
  289. {
  290.   vector   DestinationPoint        = vector( 6644, 4124, 0 );//GetNavPoint("NavPoint_04"); // where to go
  291.   vector   FormationVector         = vector( 25, 0, 0);
  292.   vector   PointOfFire             = vector( 2100, 3485, 130 );
  293.   float    CruiserSpeed            = 29; // autocade with guard should keep this speed
  294.   float    RunSpeed                = 29; // autocade wo guards should keep this speed
  295.   float    OvertakeSpeed           = 32; // maximum allowed speed for overtake
  296.   boolean  OnTanksStops             = false;
  297.  
  298.   boolean Moving = false;
  299.  
  300.   void ClearState()
  301.   {
  302.     Moving    = false;
  303.   }
  304.  
  305.   void Init()
  306.    {
  307.     SetFireStyle_Nearest();
  308.     DestinationPoint = GetNavPoint("NavPoint_04");
  309.     SetOrder_MoveTo( DestinationPoint, CruiserSpeed);
  310.    }
  311. }
  312. //-------------------------------------------------------------------------------------------
  313. class C14_BenghaziDescent extends CBaseAITask_BaseTask, CNavPointUser
  314. {
  315.   vector   DestinationPoint        = vector( 6644, 4124, 0 );//GetNavPoint("NavPoint_04"); // where to go
  316.   vector   FormationVector         = vector( 25, 0, 0);
  317.   vector   PointOfFire             = vector( 2100, 3485, 130 );
  318.   float    CruiserSpeed            = 30; // autocade with guard should keep this speed
  319.   float    RunSpeed                = 29; // autocade wo guards should keep this speed
  320.   float    OvertakeSpeed           = 32; // maximum allowed speed for overtake
  321.   boolean  OnTanksStops            = false;
  322.  
  323.   boolean Moving = false;
  324.  
  325.   void ClearState()
  326.   {
  327.     Moving    = false;
  328.   }
  329.  
  330.   void Init()
  331.    {
  332.     SetFireStyle_Nearest();
  333.     DestinationPoint = GetNavPoint("NavPoint_02");
  334.     SetOrder_MoveTo( DestinationPoint, CruiserSpeed);
  335.    }
  336. }
  337. //--------------------------------------------------------------------------------------------------
  338. class C14_BwairatDescent extends CBaseAITask_BaseTask, CNavPointUser
  339. {
  340.   vector   DestinationPoint        = vector( 6644, 4124, 0 );//GetNavPoint("NavPoint_04"); // where to go
  341.   vector   FormationVector         = vector( 25, 0, 0);
  342.   vector   PointOfFire             = vector( 2100, 3485, 130 );
  343.   float    CruiserSpeed            = 20; // autocade with guard should keep this speed
  344.   float    RunSpeed                = 29; // autocade wo guards should keep this speed
  345.   float    OvertakeSpeed           = 32; // maximum allowed speed for overtake
  346.   boolean  OnTanksStops            = false;
  347.  
  348.   boolean Moving = false;
  349.  
  350.   void ClearState()
  351.   {
  352.     Moving    = false;
  353.   }
  354.  
  355.   void Init()
  356.    {
  357.     SetFireStyle_Nearest();
  358.     DestinationPoint = GetNavPoint("NavPoint_03");
  359.     SetOrder_MoveTo( DestinationPoint, CruiserSpeed);
  360.    }
  361. }
  362.  
  363.